Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <p>This example uses the HTML DOM to assign an "onended" event to an audio element.</p> <p>Press play and wait for the audio to end.</p> <audio id="myAudio" controls> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio> <p id="demo"></p> <script> document.getElementById("myAudio").onended = function() {myFunction()}; function myFunction() { document.getElementById("demo").innerHTML = "The audio has ended."; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onended_dom by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:30:11 GMT --> </html>
Result:
Try it Yourself - © w3schools.com